#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:12操作mysql数据库修改数据.py
# author: 马国鑫
# datetime:2022/4/17 22:13
# software: PyCharm

"""
this is function  description 
"""

# import module your need

import pymysql

conn = pymysql.connect(host='localhost', user='root',
                       password='021207', database='python_db', port=3306)

cur = conn.cursor()

sql = 'delete from t_student where sname=%s'
try:
    cur.execute(sql, ('小马'))
    conn.commit()
    print('删除成功')
except Exception as e:
    print(e)
    conn.rollback()
    print('删除失败')
finally:
    cur.close()
    conn.close()
